Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR implements duplicate post prevention for the trending posts and recommendation APIs. The primary purpose is to ensure that posts already included in recommendation results are not duplicated when filling the remaining slots with recent posts.
- Added exclusion logic to prevent duplicate posts in trending post results
- Removed unused temporary vector update API and related method
- Updated repository method to accept excluded post IDs parameter
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| TrendingPostService.java | Added logic to collect existing post IDs and pass them as exclusion criteria |
| PostQueryRepository.java | Updated interface method signature to accept excluded post IDs |
| PostQueryRepositoryImpl.java | Implemented exclusion logic in the query using notIn clause |
| RecommendService.java | Removed unused updateAllPostVector method and transaction import |
| RecommendController.java | Removed unused vector update endpoint |
|
Failed to generate code suggestions for PR |
|
Walkthrough이번 변경에서는 Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
src/main/java/com/TwoSeaU/BaData/domain/trade/controller/RecommendController.java(0 hunks)src/main/java/com/TwoSeaU/BaData/domain/trade/repository/PostQueryRepository.java(2 hunks)src/main/java/com/TwoSeaU/BaData/domain/trade/repository/PostQueryRepositoryImpl.java(2 hunks)src/main/java/com/TwoSeaU/BaData/domain/trade/service/RecommendService.java(0 hunks)src/main/java/com/TwoSeaU/BaData/domain/trade/service/TrendingPostService.java(2 hunks)
💤 Files with no reviewable changes (2)
- src/main/java/com/TwoSeaU/BaData/domain/trade/controller/RecommendController.java
- src/main/java/com/TwoSeaU/BaData/domain/trade/service/RecommendService.java
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: marineAqu
PR: Ureca-Final-Project-Team2/be_badata#341
File: src/main/java/com/TwoSeaU/BaData/domain/trade/service/TrendingPostService.java:77-86
Timestamp: 2025-08-01T04:20:26.108Z
Learning: TrendingPostService에서 Redis TTL 관리는 의도적으로 갱신하지 않도록 구현되었다. 이는 인기 게시글이 지속적인 활동에도 불구하고 일정 시간(3시간) 후 자동 만료되어 트렌딩 목록이 정기적으로 갱신되도록 하는 설계 의도이다.
Learnt from: marineAqu
PR: Ureca-Final-Project-Team2/be_badata#341
File: src/main/java/com/TwoSeaU/BaData/domain/trade/service/TrendingPostService.java:47-58
Timestamp: 2025-08-01T03:24:12.001Z
Learning: BaData 프로젝트에서는 게시글 삭제 시 하드 삭제가 아닌 isDeleted 플래그를 사용한 소프트 삭제 방식을 사용한다. 따라서 Redis에 존재하는 게시글 ID가 DB에서 찾을 수 없는 경우는 데이터 무결성 문제로 간주하여 예외를 발생시키는 것이 올바른 처리 방식이다.
Learnt from: choyunju
PR: Ureca-Final-Project-Team2/be_badata#195
File: src/main/java/com/TwoSeaU/BaData/domain/trade/controller/OCRController.java:26-30
Timestamp: 2025-07-22T14:22:12.563Z
Learning: OCRController는 임시 분리된 컨트롤러로, 추후 PostService로 통합될 예정이므로 현재 단계에서는 파일 검증 로직을 별도로 구현하지 않고 통합 시점에 기존 PostService의 검증 로직을 활용하는 것이 개발 전략이다.
Learnt from: marineAqu
PR: Ureca-Final-Project-Team2/be_badata#269
File: src/main/java/com/TwoSeaU/BaData/domain/trade/controller/MockController.java:24-27
Timestamp: 2025-07-28T01:53:53.618Z
Learning: marineAqu prefers to keep method names as-is in temporary Mock APIs that are planned for deletion, prioritizing development efficiency over perfect naming conventions for code that will be removed later.
Learnt from: marineAqu
PR: Ureca-Final-Project-Team2/be_badata#365
File: src/main/java/com/TwoSeaU/BaData/domain/trade/service/PostSearchService.java:44-44
Timestamp: 2025-08-03T14:04:42.957Z
Learning: marineAqu는 개별 API의 완벽한 구현보다는 모든 API 간의 일관된 구현 패턴을 유지하는 것을 우선시한다. 보안이나 성능 개선 사항이 있더라도 전체 시스템에 대한 논의 후 일괄 적용하는 것을 선호한다.
Learnt from: marineAqu
PR: Ureca-Final-Project-Team2/be_badata#358
File: src/main/java/com/TwoSeaU/BaData/domain/trade/service/RecommendService.java:155-169
Timestamp: 2025-08-03T04:35:46.490Z
Learning: marineAqu는 곧 삭제될 예정인 API의 경우, 최적화보다는 개발 효율성을 우선시하여 현재 구현을 임시로 유지하는 것을 선호한다. 삭제될 코드에 대해서는 완벽한 구현보다는 개발 속도를 중시한다.
📚 Learning: trendingpostservice에서 redis ttl 관리는 의도적으로 갱신하지 않도록 구현되었다. 이는 인기 게시글이 지속적인 활동에도 불구하고 일정 시간(3시간) 후 자동 ...
Learnt from: marineAqu
PR: Ureca-Final-Project-Team2/be_badata#341
File: src/main/java/com/TwoSeaU/BaData/domain/trade/service/TrendingPostService.java:77-86
Timestamp: 2025-08-01T04:20:26.108Z
Learning: TrendingPostService에서 Redis TTL 관리는 의도적으로 갱신하지 않도록 구현되었다. 이는 인기 게시글이 지속적인 활동에도 불구하고 일정 시간(3시간) 후 자동 만료되어 트렌딩 목록이 정기적으로 갱신되도록 하는 설계 의도이다.
Applied to files:
src/main/java/com/TwoSeaU/BaData/domain/trade/service/TrendingPostService.java
📚 Learning: in the updatepostrequest class at src/main/java/com/twoseau/badata/domain/trade/dto/request/updatepo...
Learnt from: marineAqu
PR: Ureca-Final-Project-Team2/be_badata#146
File: src/main/java/com/TwoSeaU/BaData/domain/trade/dto/request/UpdatePostRequest.java:5-5
Timestamp: 2025-07-18T05:48:30.088Z
Learning: In the UpdatePostRequest class at src/main/java/com/TwoSeaU/BaData/domain/trade/dto/request/UpdatePostRequest.java, the user explicitly stated they don't use the default constructor and are handling JSON deserialization differently, rejecting the suggestion to add @NoArgsConstructor alongside @AllArgsConstructor.
Applied to files:
src/main/java/com/TwoSeaU/BaData/domain/trade/repository/PostQueryRepositoryImpl.javasrc/main/java/com/TwoSeaU/BaData/domain/trade/repository/PostQueryRepository.java
📚 Learning: in java, when classes are in the same package, no import statement is needed. classes in the same pa...
Learnt from: marineAqu
PR: Ureca-Final-Project-Team2/be_badata#118
File: src/main/java/com/TwoSeaU/BaData/domain/trade/entity/Payment.java:32-32
Timestamp: 2025-07-15T06:31:54.894Z
Learning: In Java, when classes are in the same package, no import statement is needed. Classes in the same package can reference each other directly without explicit imports. This applies to the Post entity in the Payment.java file where both are in the com.TwoSeaU.BaData.domain.trade.entity package.
Applied to files:
src/main/java/com/TwoSeaU/BaData/domain/trade/repository/PostQueryRepositoryImpl.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build-test
🔇 Additional comments (4)
src/main/java/com/TwoSeaU/BaData/domain/trade/repository/PostQueryRepository.java (1)
10-10: LGTM! 인터페이스 시그니처 변경이 적절합니다.중복 게시글 방지를 위해
excludedPostIds매개변수를 추가한 것이 올바른 접근입니다. Set 타입 사용도 적절합니다.Also applies to: 20-20
src/main/java/com/TwoSeaU/BaData/domain/trade/service/TrendingPostService.java (2)
20-20: LGTM! 필요한 import가 추가되었습니다.중복 방지 로직에서 사용할
Collectors.toSet()을 위한 import가 적절히 추가되었습니다.
61-64: LGTM! 중복 게시글 방지 로직이 올바르게 구현되었습니다.이미 포함된 게시글의 ID를 수집하여
getRecentPostsBySize호출 시 제외하는 로직이 정확합니다. Stream을 사용한 ID 수집과 Set으로의 변환도 효율적입니다.src/main/java/com/TwoSeaU/BaData/domain/trade/repository/PostQueryRepositoryImpl.java (1)
5-5: LGTM! 필요한 import가 추가되었습니다.Set 타입 사용을 위한 import가 적절히 추가되었습니다.
|
#️⃣연관된 이슈
🚀 작업 내용
🔍 리뷰 요청 사항